package com.jic.member.impl;

import java.lang.Long;
import java.util.List;

import com.jic.common.base.vo.Page;
import com.jic.common.base.vo.PageResult;
import com.jic.member.entity.MememberGradeAction;
import com.jic.member.mapper.MememberGradeActionMapper;
import com.jic.member.service.MememberGradeActionService;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * 会员等级管理-评价-分享-点赞-晒单-收藏赠送表
 * @author : 
 * @email : 
 * @since : 2020-04-02 07:56:36
 * @version : v1.0.0
 */
@Service
public class MememberGradeActionServiceImpl implements MememberGradeActionService{

    @Autowired
    private MememberGradeActionMapper mememberGradeActionMapper;

    @Override
    public long insert(MememberGradeAction mememberGradeAction) {
        long flag = mememberGradeActionMapper.insert(mememberGradeAction);
        return flag;
    }

    @Override
    public long delete(Long id) {
        return mememberGradeActionMapper.delete(id);
    }

    @Override
    public long update(MememberGradeAction mememberGradeAction) {
        return mememberGradeActionMapper.update(mememberGradeAction);
    }

    @Override
    public MememberGradeAction queryByPrimaryKey(Long id){
        return mememberGradeActionMapper.queryByPrimaryKey(id);
    }

    @Override
    public List<MememberGradeAction> query(MememberGradeAction mememberGradeAction){
        return mememberGradeActionMapper.query(mememberGradeAction);
    }

    @Override
    public PageResult<MememberGradeAction> queryPage(MememberGradeAction mememberGradeAction, Page pageQuery) {
        //计算下标
        int startIndex = (pageQuery.getStart() - 1) * pageQuery.getLimit();
        List<MememberGradeAction> list = mememberGradeActionMapper.queryPage(startIndex, pageQuery.getLimit(), mememberGradeAction);
        long count = mememberGradeActionMapper.queryPageCount(mememberGradeAction);
        PageResult pageResult = new PageResult();
        pageResult.setRows(list);
        pageResult.setTotal(count);
        return pageResult;
    }
}